/*
   FieldVis - A Tool for Visualizing Astrophysical Magnetohydrodynamic Flow
   
   Copyright (C) 2006 - 2008     FieldVis Development Team
  
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
  
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
  
   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

   File     : Point.h
   Author   : Blayne Field
   
   Purpose  : Definition header file for the Point class.  This class just
              holds a 3D point.
*/

#ifndef POINT_H
#define POINT_H

#include <string>
#include <vector>

#include "Vector3D.h"


class Point
{
public:

   Point() : x(0), y(0), z(0)
   {}
   Point(float px, float py, float pz)
   : x(px), y(py), z(pz)
   {}

   Vector3D PointToVector3D()    { return Vector3D(x, y, z);}

   // accessors
   float GetX() const      { return x;}
   float GetY() const      { return y;}
   float GetZ() const      { return z;}

   // mutators
   void SetX(float px)     { x = px;}
   void SetY(float py)     { y = py;}
   void SetZ(float pz)     { z = pz;}
   void MoveX(float dx)    { x += dx;}
   void MoveY(float dy)    { y += dy;}
   void MoveZ(float dz)    { z += dz;}

   void AddVector3D(Vector3D vec, float dist);

   static Vector3D VectorFromTo(Point p0, Point p1);
   static float DistanceBetween(Point p0, Point p1);
   static std::vector<Point> GetPointsFromFile(std::string fileName);

   // overloaded operators
   Point operator+(Vector3D vecToAdd);
   Point operator*(float factor);
   bool operator==(const Point & compareTo) const;
   Point &operator=(const Point & toCopy);

private:
   float x;
   float y;
   float z;
};

std::ostream & operator<<(std::ostream & out, Point & p);


// Simple representation of a bound (non origin based) vector.
//    This belongs in Vector3D.h but causes compilation issues... fix later!

class BoundVector3D
{
public:
   Point    base;
   Vector3D direction;
};


#endif
